#include "aicommandcall.h"

namespace IAlib
{

AiCommandCall::AiCommandCall()
{
    AiCommand::setType(COMMAND_CALL);
}

QByteArray AiCommandCall::toByteArray() const
{
    QByteArray byte_array;
    QDataStream data(&byte_array, QIODevice::WriteOnly);
    data<<getMode();
    data<<getNumOrigine();
    data<<getNumTarget();
    data<<getIdOrigine();
    data<<getDialogueId();
    return byte_array;
}

void AiCommandCall::fromByteArray(QByteArray &byte_array)
{
    QDataStream data(&byte_array, QIODevice::ReadOnly);
    int i_temp;
    QString s_temp;

    data>>i_temp;
    setMode((AiCommand::CommandMode)i_temp);
    data>>s_temp;
    setNumOrigine(s_temp);
    data>>s_temp;
    setNumTarget(s_temp);
    data>>s_temp;
    setIdOrigine(s_temp);
    data>>m_dialogue_id;
}

}
